//  用户模块
import request from '@/utils/request'

interface LoginParams {
  username: string
  password: string
}

interface UserInfo {
  id: number
  nickname: string
  avatar: string
}

export const userApi = {
  login: (data: LoginParams) => 
    request.post<{ token: string }>('/auth/login', data),

  getInfo: () => 
    request.get<UserInfo>('/user/info'),

  update: (data: Partial<UserInfo>) =>
    request.post('/user/update', data)
}